function size(w){
	if(w.document.body.clientHeight > w.innerHeight){
		$('.sidebar').height(w.document.body.clientHeight-98);
	}else{
		$('.sidebar').height(w.innerHeight-98);
	}
}
var reports;
function chartsResize(c){
	c.echartsInstance.resize()
}
function dataForCharts(d){
	reports = echarts.init($('#report')[0]);
	var X = [];
	var D = [];
	var D1 = [];
	var D2 = [];
	for (var i in d.m){
		X[i] = d.m[i].hour;
		D[i] = d.m[i].val;
		D1[i] = Math.floor(d.m[i].val * (Math.random() + 0.4));
		D2[i] = Math.floor(d.m[i].val * (Math.random() + 0.4));
	}
	var option = {
		title:{
			text:'今天的广告数据',
			left:'middle'
		},
		tooltip:{},
		legend:{
			left:'right',
			top:'middle',
			orient:'vertical',
			data:[{
				name:'点击'
			},{
				name:'弹窗'
			},{
				name:'富媒体'
			}]
		},
		grid:{
			width:'80%'
		},
		xAxis:{
			type:'',
			data:X,
			boundaryGap:true,
			name:'每小时数据',
			axisTick:{
				alignWithLabel:true,
			}
		},
		yAxis:{
		},
		series:[{
			name:'点击',
			type:'line',
			data:D
		},{
			name:'弹窗',
			type:'line',
			data:D1
		},{
			name:'富媒体',
			type:'line',
			data:D2
		}]
	};
	reports.setOption(option);
}
$(function(){
	size(window);
	$(window).resize(function(){
		size(window)
	});
	$(current).addClass('current');
})